// 格式化时间,秒转换为00:00格式
export function formatTime(time) {
	var formatTime
	time = ~~time;
	if(time < 10) {
		formatTime = '00:0' + time;
	}else if(time < 60) {
		formatTime = '00:' + time;
	}else {
		var m = ~~(time / 60)
		if(m<10) m = '0' + m;
		var s = time % 60;
		if(s<10) s = '0' + s;
		formatTime = m + ':' + s;
	}
	return formatTime;
}
// 格式化时间为yyyy-MM-dd HH:mm:ss
export function formatDate(date) {
  var date = new Date(date);
  var YY = date.getFullYear() + '-';
  var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
  var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
  var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
  var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
  return YY + MM + DD +" "+hh + mm + ss;
}